﻿<?xml version="1.0" encoding="utf-8" ?>
<Batch 
    xmlns="http://schemas.dbshell.com/core"
    xmlns:rds="http://schemas.dbshell.com/datasync"
    >
    <rds:SyncModel >
        <rds:SyncModel.SqlPrologAfterBeginTransaction>
            declare @restr bit;
            set @restr = 1;
        </rds:SyncModel.SqlPrologAfterBeginTransaction>
        <rds:SyncModel.Sources>
            <rds:Source DataSource="{Table Source}">
                <rds:SourceColumn Name="ID_Source" />
                <rds:SourceColumn Name="Value1" />
                <rds:SourceColumn Name="ID_SourceType" />
            </rds:Source>
            <rds:Source DataSource="{Table SourceType}">
                <rds:SourceColumn Name="ID_SourceType" />
                <rds:SourceColumn Name="ShouldBeExported" Filter="=@restr" />
            </rds:Source>
            <rds:Source DataSource="{Table SourceNotLinked}">
                <rds:SourceColumn Name="ID_SourceNotLinked" Filter="NOT NULL" />
            </rds:Source>
        </rds:SyncModel.Sources>
        <rds:SyncModel.Targets>
            <rds:Target TableName="Target" PrimarySource="Source">
                <rds:TargetColumn Name="IdOriginal" Source="ID_Source" IsKey="True" />
                <rds:TargetColumn Name="Value1" Source="Value1" />
            </rds:Target>
        </rds:SyncModel.Targets>
    </rds:SyncModel>
    
    <rds:CreateProcedure ProcName="RunSync" />
</Batch>
